package com.lemon.secondhandplatform.mode;

import cn.bmob.v3.BmobObject;

/**
 * 订单
 */
public class Order extends BmobObject {

    //交易未完成
    public static final int BUSINESS_UNFINISHED = 0;
    //交易完成
    public static final int BUSINESS_FINISHED = 1;
    //订单被取消
    public static final int ORDER_CANCELLED = 2;

    //订单商品
    private Good good;
    //卖家
    private User seller;
    //买家
    private User buyers;
    //商品名称
    private String goodName;
    //商品简介
    private String introduction;
    //商品略缩图
    private String thumbnailURL;
    //商品价格
    private Double goodPrice;
    //订单状态
    //0：交易未完成
    //1：交易完成
    //2：订单被取消
    private Integer status = BUSINESS_UNFINISHED;
    //卖家订单状态
    private Integer sellerStatus = BUSINESS_UNFINISHED;
    //买家订单状态
    private Integer buyersStatus = BUSINESS_UNFINISHED;

    public Good getGood() {
        return good;
    }

    public void setGood(Good good) {
        this.good = good;
    }

    public User getSeller() {
        return seller;
    }

    public void setSeller(User seller) {
        this.seller = seller;
    }

    public User getBuyers() {
        return buyers;
    }

    public void setBuyers(User buyers) {
        this.buyers = buyers;
    }

    public String getGoodName() {
        return goodName;
    }

    public void setGoodName(String goodName) {
        this.goodName = goodName;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getThumbnailURL() {
        return thumbnailURL;
    }

    public void setThumbnailURL(String thumbnailURL) {
        this.thumbnailURL = thumbnailURL;
    }

    public Double getGoodPrice() {
        return goodPrice;
    }

    public void setGoodPrice(Double goodPrice) {
        this.goodPrice = goodPrice;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getSellerStatus() {
        return sellerStatus;
    }

    public void setSellerStatus(Integer sellerStatus) {
        this.sellerStatus = sellerStatus;
        if (sellerStatus == BUSINESS_FINISHED && buyersStatus == BUSINESS_FINISHED) {
            setStatus(BUSINESS_FINISHED);
        }
    }

    public Integer getBuyersStatus() {
        return buyersStatus;
    }

    public void setBuyersStatus(Integer buyersStatus) {
        this.buyersStatus = buyersStatus;
        if (sellerStatus == BUSINESS_FINISHED && buyersStatus == BUSINESS_FINISHED) {
            setStatus(BUSINESS_FINISHED);
        }
    }
}
